package net.sareweb.acab.entity;

// Generated 13-abr-2010 15:53:20 by Hibernate Tools 3.2.5.Beta

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * City generated by hbm2java
 */
@Entity
@Table(name = "city", catalog = "acab")
public class City implements java.io.Serializable {

	private Integer idCity;
	private State state;
	private String name;
	private String lat;
	private String lon;
	private Set<Request> requestsForFromCity = new HashSet<Request>(0);
	private Set<Request> requestsForToCity = new HashSet<Request>(0);
	private Set<Travel> travelsForToCity = new HashSet<Travel>(0);
	private Set<Travel> travelsForFromCity = new HashSet<Travel>(0);

	public City() {
	}

	public City(State state, String name) {
		this.state = state;
		this.name = name;
	}

	public City(State state, String name, String lat, String lon,
			Set<Request> requestsForFromCity, Set<Request> requestsForToCity,
			Set<Travel> travelsForToCity, Set<Travel> travelsForFromCity) {
		this.state = state;
		this.name = name;
		this.lat = lat;
		this.lon = lon;
		this.requestsForFromCity = requestsForFromCity;
		this.requestsForToCity = requestsForToCity;
		this.travelsForToCity = travelsForToCity;
		this.travelsForFromCity = travelsForFromCity;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idCity", unique = true, nullable = false)
	public Integer getIdCity() {
		return this.idCity;
	}

	public void setIdCity(Integer idCity) {
		this.idCity = idCity;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "state", nullable = false)
	@NotNull
	public State getState() {
		return this.state;
	}

	public void setState(State state) {
		this.state = state;
	}

	@Column(name = "name", nullable = false, length = 200)
	@NotNull
	@Length(max = 200)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "lat", length = 16777215)
	@Length(max = 16777215)
	public String getLat() {
		return this.lat;
	}

	public void setLat(String lat) {
		this.lat = lat;
	}

	@Column(name = "lon", length = 16777215)
	@Length(max = 16777215)
	public String getLon() {
		return this.lon;
	}

	public void setLon(String lon) {
		this.lon = lon;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "cityByFromCity")
	public Set<Request> getRequestsForFromCity() {
		return this.requestsForFromCity;
	}

	public void setRequestsForFromCity(Set<Request> requestsForFromCity) {
		this.requestsForFromCity = requestsForFromCity;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "cityByToCity")
	public Set<Request> getRequestsForToCity() {
		return this.requestsForToCity;
	}

	public void setRequestsForToCity(Set<Request> requestsForToCity) {
		this.requestsForToCity = requestsForToCity;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "cityByToCity")
	public Set<Travel> getTravelsForToCity() {
		return this.travelsForToCity;
	}

	public void setTravelsForToCity(Set<Travel> travelsForToCity) {
		this.travelsForToCity = travelsForToCity;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "cityByFromCity")
	public Set<Travel> getTravelsForFromCity() {
		return this.travelsForFromCity;
	}

	public void setTravelsForFromCity(Set<Travel> travelsForFromCity) {
		this.travelsForFromCity = travelsForFromCity;
	}

}
